package com.example.app.components


import android.util.Log
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp

@Composable
fun Modifier() {
    // 当有些控件没有background属性时,可以使用modifier
    // modifier属性设置的先后顺序不一致会导致不同的效果
    Text(
        text = "wsh3038971",
        style = TextStyle(background = Color.Cyan),
        modifier = Modifier
            .padding(8.dp)
            .background(Color.LightGray)
            .border(2.dp, Color.Red)
            .clickable {
                Log.i("=====", "按钮已点击")
            }
    )
}

@Preview(showSystemUi = true)
@Composable
fun ModifierPreview() {
    Modifier()
}

